define(function (require) {
    'use strict';
    var queryFullApp =require('app/QueryFullApp');
    return {
        controller: function (scope) {
            var self = this;
            this.scope = scope;
            queryFullApp.init();
            scope.logoUri = $.i18n.image('logo-top.png');
            scope.loginText = $.i18n.text('login_title');
            scope.rotationIcon = false;
            scope.goHome = function () {
                ePart.pcUtils.stateUrl().go('index');
            };
            scope.switchingMenu = function () {
                self.scope.rotationIcon = !self.scope.rotationIcon;
            };
            scope.showFullLoginDialog = function () {
                ePart.pcUtils.dialog('loginDialog', self.scope);
            };
            this.scope.menuList = ePart.app.cfg.FULL_MENU_LIST;
            this.monitoringMenu();
        },
        monitoringMenu: function () {
            var self = this;
            this.scope.$on('$stateChangeSuccess', function () {
                self.scope.rotationIcon = false;
                var currentPath = ePart.pcUtils.location().path(),
                    pathList = currentPath.split('/');
                if (pathList.length === 2 || pathList.length === 3) {
                    if (pathList[1] === 'index' || self._containerMenuProcess(pathList[2])) {
                        self.scope.curMenuTitle = $.i18n.text('fullName');
                        //以后通过一个接口；在进入项目的时候统一请求（建议请求从preload中开始）
                        self.scope.curSubMenuList = self._judgmentMenuProcess(pathList[2] || pathList[1]);
                    }
                } else {
                    //单极菜单显示状态（后期分为可点击和不可点击
                    self.scope.curSubMenuList = [];

                }
            });
        },
        _containerMenuProcess: function (pathStr) {
            var mainMenuList = ['HOME', 'VOD', 'KIDS', 'PERSON'];
            return mainMenuList.indexOf(pathStr) !== -1;
        },
        _judgmentMenuProcess: function (menuType) {
            return menuType !== 'PERSON' ? ePart.app.cfg.MY_MENU_LIST : ePart.app.cfg.OTHER_MENU_LIST
        }
    }
});
